package day1105.second;

import day1105.common.MyUtil;
import day1105.common.Student;

import java.util.List;

import static day1105.common.MyUtil.printLine;

/**
 * @author Mr.ma
 * @since 2022/11/6 16:09
 **/
public class SkipTest {
    public static void main(String[] args) {
        List<Student> studentList = MyUtil.createStudentList();
        studentList.stream().forEach(System.out::println);
        printLine("跳过年龄最大的学生，给其余学生年龄加一");
        studentList.stream().sorted((s1,s2) -> s2.getAge() - s1.getAge())
                .skip(3)
                .map(x -> {x.setAge(x.getAge() + 1); return x;})
                .forEach(System.out::println);
    }
}
